package com.ali.common;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum ReturnEnum {
    RC200("200", "请求成功"),
    RC999("999", "请求失败");

    private final String code;
    private final String message;

    ReturnEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String getMessage(String code) {
        for (ReturnEnum returnEnum : ReturnEnum.values()) {
            if (Objects.equals(code, returnEnum.code)) {
                return returnEnum.message;
            }
        }
        return "";
    }
}
